using System.Windows.Media.Imaging;
using MediaOwl.Netflix.Model;
using MediaOwl.Netflix.NetflixServiceReference;

namespace MediaOwl.Netflix.Data
{
    public class Helper
    {
        #region GetScreenIds

        internal static string GetScreenId(object o)
        {
            if (o is Genre)
                return GetScreenId((Genre) o);

            if (o is Person)
                return GetScreenId((Person) o);

            if (o is Title)
                return GetScreenId((Title) o);

            if (o is GenreExtended)
                return GetScreenId(((GenreExtended) o).GenreBase);

            if (o is BitmapImage)
                return ((BitmapImage)o).UriSource.AbsoluteUri;

            if (o is string)
                return (string)o;

            return o.GetHashCode().ToString();
        }

        internal static string GetScreenId(Genre genre)
        {
            return genre.Name;
        }

        internal static string GetScreenId(Person person)
        {
            return person.Id.ToString();
        }

        internal static string GetScreenId(Title title)
        {
            return title.Id;
        }

        #endregion
    }
}